{
  Copyright 2012, Jameel Halabi

  This unit is part of the BlaiseWave wrapper,
  which is licensed under the BSD 2-Clause license (see licenses/license.txt).
}

unit BW_Modeler;

{$mode objfpc}{$H+}

interface

uses
  LW_Types  ,
  LW_Modeler ,
  BW_Global  ;

type

  { TStateQueryFuncs }

  TStateQueryFuncs = class(TGlobal)
  protected
    function GetGlobalType                   : String; override;
  public
    function NumLayers
             ( const Void                 ) : Integer ;
    function LayerMask
             (       OpLayer : TEltOpLayer) : Uint32  ;
    function Surface
             ( const Void                 ) : PChar   ; // const
    function BBox
             (       OpLayer : TEltOpLayer;
                     Minmax  : PDouble    ) : Uint32  ;
    function LayerList
             (       OpLayer : TEltOpLayer;
               const ObjName : PChar      ) : PChar   ; // const
    function Object_
             ( const Void                 ) : PChar   ; // const
    function Mode
             (       Setting : Integer    ) : Integer ;
    function VMap
             (       Index   : Integer    ;
                     LWID    : PLWID      ) : PChar   ; // const
  end;

  { TFontListFuncs }

  TFontListFuncs = class(TGlobal)
  protected
    function GetGlobalType                   : String; override;
  public
    function  Count
              ( const Void                  ) : Integer ;
    function  Index
              ( const Name     : PChar      ) : Integer ;
    function  Load
              ( const Filename : PChar      ) : Integer ;
    procedure Clear
              (       InIndex  : Integer    ) ;
  end;

implementation

{ TStateQueryFuncs }

function TStateQueryFuncs.GetGlobalType: String;
begin
  Result := LWSTATEQUERYFUNCS_GLOBAL ;
end;

function TStateQueryFuncs.NumLayers
                          (  const Void                  ) : Integer;
begin
  Result := PLWStateQueryFuncs(FGlobal)^.NumLayers(Void);
end;

function TStateQueryFuncs.LayerMask
                          (        OpLayer : TEltOpLayer ) : Uint32;
begin
  Result := PLWStateQueryFuncs(FGlobal)^.LayerMask(OpLayer);
end;

function TStateQueryFuncs.Surface
                          (  const Void                  ) : PChar;
begin
  Result := PLWStateQueryFuncs(FGlobal)^.Surface(Void);
end;

function TStateQueryFuncs.BBox
                          (        OpLayer : TEltOpLayer ;
                                   Minmax  : PDouble     ) : Uint32;
begin
  Result := PLWStateQueryFuncs(FGlobal)^.LayerMask(OpLayer, Minmax);
end;

function TStateQueryFuncs.LayerList
                          (        OpLayer : TEltOpLayer;
                             const ObjName : PChar       ) : PChar;
begin
  Result := PLWStateQueryFuncs(FGlobal)^.LayerList(OpLayer, ObjName);
end;

function TStateQueryFuncs.Object_
                          (  const Void                  ) : PChar;
begin
  Result := PLWStateQueryFuncs(FGlobal)^.Object_(Void);
end;

function TStateQueryFuncs.Mode
                          (        Setting : Integer     ) : Integer;
begin
  Result := PLWStateQueryFuncs(FGlobal)^.Mode(Setting);
end;

function TStateQueryFuncs.VMap
                          (        Index  : Integer      ;
                                   LWID   : PLWID        ) : PChar;
begin
  Result := PLWStateQueryFuncs(FGlobal)^.VMap(Index, LWID);
end;

{ TFontListFuncs }

function TFontListFuncs.GetGlobalType: String;
begin
  Result := LWFONTLISTFUNCS_GLOBAL ;
end;

function TFontListFuncs.Count(const Void): Integer;
begin
  Result := PLWFontListFuncs(FGlobal)^.Count(Void);
end;

function TFontListFuncs.Index(const Name: PChar): Integer;
begin
  Result := PLWFontListFuncs(FGlobal)^.Index(Name);
end;

function TFontListFuncs.Load(const Filename: PChar): Integer;
begin
  Result := PLWFontListFuncs(FGlobal)^.Load(Filename);
end;

procedure TFontListFuncs.Clear(InIndex: Integer);
begin
  PLWFontListFuncs(FGlobal)^.Clear(InIndex);
end;

end.
